package com.qf.controller;

import com.qf.model.StandardSubmit;
import com.qf.service.SearchService;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author YDW
 * projectName:project2202_4
 * time:2022/6/24 10:45
 * description:
 */
@RestController
@RequestMapping("/search")
public class SearchController {
    @Autowired
    SearchService searchService;
    @RequestMapping("/search")
    public List<Map> searchLog(@RequestParam("params") String paras) throws IOException {
        return searchService.searchlist(paras);

    }

    @RequestMapping( "/searchcount")
    Long searchLogCount(@RequestParam("params") String paras) throws IOException {
        return searchService.searchLogCount(paras);
    }
}
